@extends('admin.layout.index')

@section('content')
	<div class="col-md-12">
	    <!-- Advanced Tables -->
	    <div class="card">
	        <div class="card-action">
	           管理员列表
	        </div>
	        <div class="card-content">
	            <div class="">
	                <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline"
	                role="grid">
	                    <div class="row"> 
	                    	<form action="/admin/administrators/index" method="get">
	                       	 	<div class="col-sm-6">
		                            <div class="dataTables_length" id="dataTables-example_length">
		                                <label>
		                                    <select name="count" aria-controls="dataTables-example"
		                                    class="form-control input-sm">
		                                        <option value="10" @if(!empty($request['count']) && $request['count'] == 10) selected @endif >
		                                            10
		                                        </option>
		                                        <option value="15" @if(!empty($request['count']) && $request['count'] == 15) selected @endif>
		                                            15
		                                        </option>
		                                        <option value="20" @if(!empty($request['count']) && $request['count'] == 20) selected @endif>
		                                            20
		                                        </option>
		                                    </select>
		                                    <span style="font-size:13px"></span>
		                                </label>
		                            </div>
		                        </div>
		                        <div class="col-sm-6">
		                            <div id="dataTables-example_filter" class="dataTables_filter">
		                                <label>
		                                   <span style="font-size:16px">关键字:</span>
		                                    <input type="search" name="search" class="form-control input-sm" aria-controls="dataTables-example" value="{{ $request['search'] or ''}}">　　
		                                    <button type="submit" class="btn btn-lg btn-primary" style="font-size:13px"> 搜索 </button>
		                                </label>
		                            </div>
		                        </div>
	                        </form>
	                    </div>
	                    <table class="table table-striped table-bordered table-hover dataTable no-footer"
	                    id="dataTables-example" aria-describedby="dataTables-example_info">
	                        <thead>
	                            <tr role="row">
	                                <th style="text-align:center;">
	                                    管理员名称
	                                </th>
	                                <th style="text-align:center;">
	                                    注册时间
	                                </th>
	                                <th style="text-align:center;">
	                                    最后登录时间
	                                </th>
	                                <th style="text-align:center;">
	                                    管理员权限
	                                </th>
	                                <th style="text-align:center;">
	                                    管理员状态
	                                </th>
	                                @if($array['merchant'] == 1)
		                                <th style="text-align:center;">
		                                    操作
		                                </th>
		                            @endif
	                            </tr>
	                        </thead>
	                        <tbody>
		                        @foreach($data as $k=>$v)
		                            <tr class="gradeA odd">
		                                <td style="text-align:center;">
		                                    {{ $v['id'] }}
		                                </td>
		                                <td style="text-align:center;">
		                                    {{ date('Y-m-d H:i:s',$v['ctime']) }}
		                                </td>
		                                <td style="text-align:center;">
		                                	@if($v['lasttime'] != null)
		                                    	{{ date('Y-m-d H:i:s',$v['lasttime']) }}
		                                    @else
		                                    	未登录
		                                    @endif
		                                </td>
		                                <td style="text-align:center;">
		                                	@if($v['merchant'] == 0)
		                                    	普通管理员
		                                    @else
		                                    	超级管理员
		                                    @endif
		                                </td>
		                                <td style="text-align:center;">
		                                    @if($v['status'] == 0)
		                                		开启
		                                	@else
		                                		禁用
		                                	@endif 
		                                </td>
		                                @if($array['merchant'] == 1)
			                                <td style="text-align:center;">
			                                	@if($v['merchant'] == 0)
				                                    <a href="/admin/administrators/delete?id={{ $v['id'] }}" title="删除" onclick="return confirm('你确定要删除该管理员吗？')"><i class="material-icons dp48">delete</i></a>　 
				                                	@if($v['status'] == 0)
			                                			<a href="/admin/administrators/update?id={{ $v['id'] }}&status=1" title="禁用" onclick="return confirm('你确定要禁用该管理员吗？')"><i class="material-icons dp48">lock</i></a>　
			                                		@else
			                                			<a href="/admin/administrators/update?id={{ $v['id'] }}&status=0" title="开启" onclick="return confirm('你确定要启用该管理员吗？')"><i class="material-icons dp48">vpn_key</i></a>　
			                                		@endif 
		                                		@endif
			                                </td>
			                            @endif
		                            </tr>
		                        @endforeach
	                        </tbody>
	                    </table>
	                    <div class="row">
	                        <div class="col-sm-5">
	                            <div class="dataTables_info" id="dataTables-example_info" role="alert"
	                            aria-live="polite" aria-relevant="all">
	                                共{{ $datacount }}条
	                            </div>
	                        </div>
	                        <div class="col-sm-7">
	                            <div class="dataTables_paginate paging_simple_numbers" id="dataTables-example_paginate">
	                             	{!! $data->appends($request)->render() !!}
	                            </div>
	                        </div>
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
	    <!--End Advanced Tables -->
	</div>
@endsection